import Icon from '@/components/Icon'
import styled from 'styled-components'
import img from '@img/all.png'
interface WrapProps {
	nestingLevel: number
	isVip: boolean
	isOnline: boolean
	isMeeting: boolean
	isNameBlue: boolean
	paddingWidth: number
}
export const IconBatchPollState = styled(Icon)`
	width: 18px;
	height: 18px;
	background-position: -342px -3304px;
	margin-right: 4px;
`
/**批量轮询编辑 */
export const IconActionEditBatchPoll = styled(Icon)`
	width: 24px;
	height: 24px;
	position: absolute;
	top: -2px;
	background-position: 0px -3322px;
	&:hover {
		background-position: -48px -3322px;
	}
`
export const IconActionEditBatchPollDisabled = styled(Icon)`
	width: 24px;
	height: 24px;
	position: absolute;
	top: -2px;
	background-position: -72px -3322px;
`
export const StyledListItem = styled.div`
	.list-header {
		align-items: flex-start;
		display: flex;
		flex-direction: row;
		height: 40px;
	}
	display: flex;
	&:hover {
		background: #c1dbec;
		.mt-status {
			display: none;
		}
		.mt-action {
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
	&.selected {
		background: #2381b6;
		.name {
			color: white;
		}
		.mt-status {
			display: none;
		}
		.mt-action {
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
	.mt-status {
		flex: 0 0 50px;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		padding-right: 10px;
	}
	.mt-action {
		flex: 0 0 50px;
		display: none;
		padding-left: 10px;
	}
	.is-calling {
		color: #2f9d6b;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		margin-right: 10px;
	}
`
export const ItemLabelWrap = styled.div<WrapProps>`
	display: flex;
	flex: 1;
	align-items: center;
	height: 38px;
	box-sizing: border-box;
	padding-left: ${(props) => {
		return props.paddingWidth + 'px'
		// if (props.isOnline && props.isMeeting) {
		// 	return `${props.nestingLevel * 22 + 18}px`
		// } else {
		// 	return `${props.nestingLevel * 22 + (props.nestingLevel > 0 ? 10 : 0) + 18}px`
		// }
	}};
	overflow: hidden;
	.icon-toggle {
		flex: 0 0 14px;
		margin-right: 7px;
	}
	.icon-single-poll {
		left: ${(props) => {
			return `${props.nestingLevel * 22 + (props.nestingLevel > 0 ? 10 : 0)}px`
		}};
	}
	.avatar {
		flex: 0 0 24px;
		display: flex;
		align-items: center;
		position: relative;
		margin-right: 8px;
		.icon-right {
			position: absolute;
			bottom: -1px;
			right: -4px;
		}
	}
	.vip {
		flex: 0 0 26px;
		height: 15px;
		background-color: #5eb9ef;
		color: #ffffff;
		line-height: 15px;
		text-align: center;
		margin-right: 8px;
	}
	.name {
		color: ${(props) =>
			props.isOnline ? (props.isNameBlue ? `#2C8DC5` : `#000`) : props.isVip ? `#4e4e4e` : `#959697`};
		overflow: hidden;
		&.active-polling {
			color: #2bb7ff;
			font-weight: bold;
		}
		pre {
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
`
export const StyledMemberList = styled.div`
	flex: 1;
	display: flex;
	flex-direction: column;
	.content-wrap {
		display: flex;
		flex: 1;
		height: 100%;
	}
	.sort_option {
		height: 100%;
		display: inline-flex;
		flex-direction: column;
		justify-content: center;
		margin: 0px 0px 0px 8px;
		span {
			background: url(${img});
			display: block;
			width: 30px;
			height: 30px;
			margin-bottom: 20px;
			cursor: pointer;
		}
		.move-top {
			background-position: -120px -425px;
			&:hover {
				background-position: -150px -425px;
			}
		}
		.move-top.disabled {
			background-position: -210px -425px;
		}
		.move-up {
			background-position: -0px -455px;
			&:hover {
				background-position: -30px -455px;
			}
		}
		.move-up.disabled {
			background-position: -90px -455px;
		}
		.move-down {
			background-position: -120px -455px;
			&:hover {
				background-position: -150px -455px;
			}
		}
		.move-down.disabled {
			background-position: -210px -455px;
		}
		.move-bottom {
			background-position: -240px -425px;
			&:hover {
				background-position: -270px -425px;
			}
		}
		.move-bottom.disabled {
			background-position: -330px -425px;
		}
	}
	.top-size {
		margin: 6px 0 16px;
		position: relative;
		.list-header-title {
			margin-right: 16px;
		}
		.list-select {
			margin: 0px 8px;
		}
		.list-select-num {
			margin-right: 8px;
		}
	}
	.search {
		margin-bottom: 5px;
	}
	.member-list {
		flex: 1;
		// overflow-y: auto;
		.list-item {
			height: 34px;
			line-height: 34px;
			cursor: pointer;
			user-select: none;
			.name {
				margin-left: 10px;
			}
		}
	}
	.tip {
		color: #ccc;
		height: 21px;
		margin: 8px 0;
		.icon-tips {
			margin-right: 10px;
			vertical-align: top;
		}
	}
`

export const IconMute = styled(Icon)<{ isOn: boolean }>`
	width: 24px;
	height: 24px;
	background-position: ${(props) => (props.isOn ? '-282px -2541px' : '-338px -2541px')};
	&:hover {
		width: 24px;
		height: 24px;
		background-position: ${(props) => (props.isOn ? '-310px -2541px' : '-366px -2541px')};
	}
`
export const IconRight = styled(Icon)`
	width: 14px;
	height: 14px;
	background-position: 0px -3346px;
`
export const IconSinglePoll = styled(Icon)`
	width: 18px;
	height: 18px;
	background-position: -342px -3304px;
	position: absolute;
	left: 0;
`
export const IconTips = styled(Icon)`
	height: 21px;
	width: 21px;
	background-position: 0 -558px;
`
/**
 * 呼叫
 */
export const IconActionOffline = styled(Icon)`
	width: 24px;
	height: 24px;
	background-position: -394px -2541px;
	&:hover {
		width: 24px;
		height: 24px;
		background-position: -422px -2541px;
	}
`
export const StyledFooter = styled.div`
	&.footer {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 22px;
		.msg {
			margin-left: 50px;
			position: absolute;
			left: 0;
			color: #949799;
			height: 24px;
			line-height: 24px;
			display: flex;
			.icon-tips {
				margin-right: 8px;
			}
		}
	}
`
export const StyledPollModal = styled.div<{ superMtNum: 0 | 1 }>`
	padding: 0 35px;
	.transfer-wrap {
		position: relative;
		display: flex;
		margin-top: 30px;
		.left-list {
			height: 464px;
			width: 312px;
			.tab {
				position: relative;
				z-index: 1;
				span {
					box-sizing: border-box;
					display: inline-block;
					height: 37px;
					line-height: 37px;
					width: 90px;
					text-align: center;
					cursor: pointer;
					border: 1px solid transparent;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					&.selected {
						border: 1px solid #e5e5e5;
						border-top: 2px solid #1e94da;
						border-bottom: 1px solid #ffffff;
					}
				}
			}
			.content {
				position: absolute;
				top: ${(props) => (props.superMtNum === 0 ? '36px' : '0')};
				height: ${(props) => (props.superMtNum === 0 ? '430px' : '466px')};
				width: 312px;
				border: 1px solid #e5e5e5;
				padding: 0 13px;
				box-sizing: border-box;
				overflow-y: scroll;
				.search-wrap {
					height: 40px;
					display: flex;
					align-items: flex-end;
					margin-bottom: 8px;
				}
			}
			.list-item {
				height: 38px;
				line-height: 38px;
				display: flex;
				align-items: center;
				cursor: pointer;
				user-select: none;
				&:hover {
					background: #c1dbec;
					color: #fff;
				}
				.icon-wrap {
					display: inline-flex;
					align-items: center;
					justify-content: center;
					width: 30px;
					height: 100%;
					.icon {
						display: inline-block;
						width: 14px;
						height: 14px;
						background-image: url(${img});
					}
				}
				.name {
					margin-left: 10px;
				}
				&.selected {
					background: #ffffff;
					color: #666;
					.icon {
						background-position: -326px -1671px;
					}
				}
				&.selected:hover {
					background: #c1dbec;
					color: #666;
					.icon {
						background-position: -326px -1671px;
					}
				}
				&.checked {
					background: #2381b6;
					color: #fff;
					.icon {
						// background-position: -92px -1671px;
					}
					&.selected .icon {
						background-position: -344px -1671px;
					}
				}
			}
		}
		.transfer-operate {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			width: 70px;
			.btn {
				display: block;
				width: 30px;
				height: 30px;
				margin-bottom: 20px;
				background-image: url(${img});
				cursor: pointer;
			}
			.all-right {
				background-position: -240px -365px;
				&:hover {
					background-position: -270px -365px;
				}
				&:active {
					background-position: -300px -365px;
				}
			}
			.right {
				background-position: 0px -395px;
				&:hover {
					background-position: -30px -395px;
				}
				&:active {
					background-position: -60px -395px;
				}
			}
			.left {
				background-position: -120px -395px;
				&:hover {
					background-position: -150px -395px;
				}
				&:active {
					background-position: -180px -395px;
				}
			}
			.all-left {
				margin-bottom: 0;
				background-position: -240px -395px;
				&:hover {
					background-position: -270px -395px;
				}
				&:active {
					background-position: -300px -395px;
				}
			}
		}
		.right-list {
			height: 464px;
			width: 312px;
			border: 1px solid #e5e5e5;
			.title {
				box-sizing: border-box;
				height: 34px;
				line-height: 34px;
				text-align: center;
				border-bottom: 1px solid #e5e5e5;
			}
			.content {
				height: calc(100% - 34px);
				overflow-y: auto;
			}
			.list-item {
				height: 38px;
				line-height: 38px;
				display: flex;
				align-items: center;
				cursor: pointer;
				user-select: none;
				&:hover {
					background: #c1dbec;
					color: #fff;
				}
				.icon-wrap {
					display: inline-flex;
					align-items: center;
					justify-content: center;
					width: 30px;
					height: 100%;
					.icon {
						display: inline-block;
						width: 14px;
						height: 14px;
						background-image: url(${img});
						background-position: -2px -1671px;
					}
				}
				.name {
					margin-left: 10px;
				}
				&.selected {
					background: #ffffff;
					color: #666;
					.icon {
						background-position: -326px -1671px;
					}
				}
				&.selected:hover {
					background: #c1dbec;
					color: #666;
					.icon {
						background-position: -326px -1671px;
					}
				}
				&.checked {
					background: #2381b6;
					color: #fff;
					.icon {
						background-position: -92px -1671px;
					}
					&.selected .icon {
						background-position: -344px -1671px;
					}
				}
			}
		}
		.right-operate {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			width: 50px;
			position: absolute;
			top: 0;
			bottom: 0;
			right: -15px;
			.btn {
				display: block;
				width: 30px;
				height: 30px;
				margin-bottom: 20px;
				background-image: url(${img});
				cursor: pointer;
			}
			.top {
				background-position: -120px -425px;
				&:hover {
					background-position: -150px -425px;
				}
				&:active {
					background-position: -180px -425px;
				}
			}
			.up {
				background-position: 0 -455px;
				&:hover {
					background-position: -30px -455px;
				}
				&:active {
					background-position: -60px -455px;
				}
			}
			.down {
				background-position: -120px -455px;
				&:hover {
					background-position: -150px -455px;
				}
				&:active {
					background-position: -180px -455px;
				}
			}
			.bottom {
				margin-bottom: 0;
				background-position: -240px -425px;
				&:hover {
					background-position: -270px -425px;
				}
				&:active {
					background-position: -300px -425px;
				}
			}
		}
	}
`
